/*	*****************************************************************************/
/*     	File Name:	Appendix B post-review kappa analysis.do					*/
/*     	Date:   	December 22, 2020											*/
/*      Author: 	Abigail Matthews and Jason Rantanen							*/
/*      Purpose:	Kappa analysis of 2012-2019 data (post-review)		 		*/
/* 		Input files: "Part II post-review data for kappa analysis.dta"			*/
/*	*****************************************************************************/

/* This code reports on the inter-rater comparisons following the coder review of disagreements.*/


use "Appendix B post-review.dta", clear


keep if Final_Determination==2

//ProceduralPosture
tab coder1_Proc_Post_103
sort coder1_Proc_Post_103
encode coder1_Proc_Post_103, gen(coder1_Proc_Post_103_temp)
drop coder1_Proc_Post_103
rename coder1_Proc_Post_103_temp coder1_Proc_Post_103
tab coder1_Proc_Post_103
recode coder1_Proc_Post_103 (1=2) (4=1) (5=9) (6=5) (7=4) (8=10)
label define coder1_Proc_Post_103 1 Jury 2 Bench 3 JMOL 4 SJ 5 PI 6 Mixed 7 Interference 8 ITC 9 PTO 10 Other, replace
label values coder1_Proc_Post_103 coder1_Proc_Post_103
tab coder1_Proc_Post_103

tab coder2_Proc_Post_103_Total
sort coder2_Proc_Post_103_Total
encode coder2_Proc_Post_103_Total, gen(coder2_Proc_Post_103_Total_temp)
drop coder2_Proc_Post_103_Total
rename coder2_Proc_Post_103_Total_temp coder2_Proc_Post_103_Total
recode coder2_Proc_Post_103_Total (1=2) (4=1) (5=9) (6=5) (7=4) (8=10)
label define coder2_Proc_Post_103_Total 1 Jury 2 Bench 3 JMOL 4 SJ 5 PI 6 Mixed 7 Interference 8 ITC 9 PTO 10 Other, replace
label values coder2_Proc_Post_103_Total coder2_Proc_Post_103_Total
tab coder2_Proc_Post_103_Total

//PostureOutcome
tab coder1_Post_Outcome_103
sort coder1_Post_Outcome_103
encode coder1_Post_Outcome_103, gen(coder1_Post_Outcome_103_temp)
drop coder1_Post_Outcome_103
rename coder1_Post_Outcome_103_temp coder1_Post_Outcome_103
recode coder1_Post_Outcome_103 (1=3) (2=4) (3=2) (4=1)
label define coder1_Post_Outcome_103 1 Obvious 2 Nonobvious 3 Both 4 "No Final Determination", replace
label values coder1_Post_Outcome_103 coder1_Post_Outcome_103
tab coder1_Post_Outcome_103

tab coder2_Post_Outcome_103_Total
sort coder2_Post_Outcome_103_Total
encode coder2_Post_Outcome_103_Total, gen(coder2_Post_Outcome_103Totaltemp)
drop coder2_Post_Outcome_103_Total
rename coder2_Post_Outcome_103Totaltemp coder2_Post_Outcome_103_Total
recode coder2_Post_Outcome_103_Total (1=3) (2=4) (3=2) (4=1)
label define coder2_Post_Outcome_103_Total 1 Obvious 2 Nonobvious 3 Both 4 "No Final Determination", replace
label values coder2_Post_Outcome_103_Total coder2_Post_Outcome_103_Total
tab coder2_Post_Outcome_103_Total

//CAFC_Result
tab coder1_CAFC_Outcome_103
sort coder1_CAFC_Outcome_103
encode  coder1_CAFC_Outcome_103, gen(coder1_CAFC_Outcome_103_temp)
drop  coder1_CAFC_Outcome_103
rename  coder1_CAFC_Outcome_103_temp coder1_CAFC_Outcome_103
recode coder1_CAFC_Outcome_103 (1=3) (2=4) (3=2) (4=1)
label define coder1_CAFC_Outcome_103 1 Obvious 2 Nonobvious 3 Both 4 "No Final Determination", replace
label values coder1_CAFC_Outcome_103 coder1_CAFC_Outcome_103
tab coder1_CAFC_Outcome_103

tab coder2_CAFC_Outcome_103_Total
sort coder2_CAFC_Outcome_103_Total
encode coder2_CAFC_Outcome_103_Total, gen(coder2_CAFC_Outcome_103Totaltemp)
drop coder2_CAFC_Outcome_103_Total
rename coder2_CAFC_Outcome_103Totaltemp coder2_CAFC_Outcome_103_Total
recode coder2_CAFC_Outcome_103_Total (1=3) (2=4) (3=2) (4=1)
label define coder2_CAFC_Outcome_103_Total 1 Obvious 2 Nonobvious 3 Both 4 "No Final Determination", replace
label values coder2_CAFC_Outcome_103_Total coder2_CAFC_Outcome_103_Total
tab coder2_CAFC_Outcome_103_Total

//Disposition
tab coder1_Disposition_103
sort coder1_Disposition_103
encode coder1_Disposition_103, gen(coder1_Disposition_103_temp)
drop coder1_Disposition_103
rename coder1_Disposition_103_temp coder1_Disposition_103
recode coder1_Disposition_103 (3=2) (2=4) (4=3)
label define coder1_Disposition_103 1 Affirmed 2 Reversed 3 Vacated 4 Mixed, replace
label values coder1_Disposition_103 coder1_Disposition_103
tab coder1_Disposition_103

tab coder2_Disposition_103_Total
sort coder2_Disposition_103_Total
encode coder2_Disposition_103_Total, gen(coder2_Disposition_103Totaltemp)
drop coder2_Disposition_103_Total
rename coder2_Disposition_103Totaltemp coder2_Disposition_103_Total
recode coder2_Disposition_103_Total (3=2) (2=4) (4=3)
label define coder2_Disposition_103_Total 1 Affirmed 2 Reversed 3 Vacated 4 Mixed, replace
label values coder2_Disposition_103_Total coder2_Disposition_103_Total
tab coder2_Disposition_103_Total


********************************************************************************
**# Appendix Table B6 Kappa values are in the code below. 

**# Appendix Table B7. POST-REVIEW PROCEDURAL POSTURE
label var coder1_Proc_Post_103 "Coder 1 Procedural Posture"
label var coder2_Proc_Post_103_Total "Coder 2 Procedural Posture"
asdoc tab coder1_Proc_Post_103 coder2_Proc_Post_103_Total, label font(Times New Roman) fs(12) save(PPpostreview.doc) replace title(\i) 

kap coder1_Proc_Post_103 coder2_Proc_Post_103_Total, tab
kappaetc coder1_Proc_Post_103 coder2_Proc_Post_103_Total, benchmark showscale

**# Appendix Table B8. POST-REVIEW LOWER COURT RESULT
label var coder1_Post_Outcome_103 "Coder 1 Lower Court Result"
label var coder2_Post_Outcome_103_Total "Coder 2 Lower Court Result"
asdoc tab coder1_Post_Outcome_103 coder2_Post_Outcome_103_Total, label font(Times New Roman) fs(12) save(PostOutcomepostreview.doc) replace title(\i) 

kap coder1_Post_Outcome_103 coder2_Post_Outcome_103_Total, tab
kappaetc coder1_Post_Outcome_103 coder2_Post_Outcome_103_Total, benchmark showscale


**# Appendix Table B9. POST-REVIEW FEDERAL CIRCUIT RESULT 
label var coder1_CAFC_Outcome_103 "Coder 1 Federal Circuit Result"
label var coder2_CAFC_Outcome_103_Total "Coder 2 Federal Circuit Result"
asdoc tab coder1_CAFC_Outcome_103 coder2_CAFC_Outcome_103_Total, label font(Times New Roman) fs(12) save(CAFCpostreview.doc) replace title(\i) 

kap coder1_CAFC_Outcome_103 coder2_CAFC_Outcome_103_Total, tab
kappaetc coder1_CAFC_Outcome_103 coder2_CAFC_Outcome_103_Total, benchmark showscale

**# **# Appendix Table B10. POST-REVIEW FEDERAL CIRCUIT DISPOSITION
label var coder1_Disposition_103 "Coder 1 Federal Circuit Disposition"
label var coder2_Disposition_103_Total "Coder 2 Federal Circuit Disposition"
asdoc tab coder1_Disposition_103 coder2_Disposition_103_Total, label font(Times New Roman) fs(12) save(FedCirDispositionpostreview.doc) replace title(\i) 

kap coder1_Disposition_103 coder2_Disposition_103_Total, tab
kappaetc coder1_Disposition_103 coder2_Disposition_103_Total, benchmark showscale
